Skip to content

Add advisory release evaluations and baseline promotion - #2809

Open
edelauna wants to merge 1 commit into
mainfrom
issue/2085
Open

edelauna wants to merge 1 commit into
mainfrom
issue/2085

Conversation

@edelauna

@edelauna edelauna commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes #2085.

Description

Release evaluations need approved baselines and durable reports. This change adds stored-result comparisons and explicit baseline promotion.

  • Run evaluations on protected stable tags. Retain manual runs on protected main or stable tags.
  • Keep evaluation and Marketplace publishing independent. Publication never waits for evaluation approval, completion, or success.
  • Require environment approval before provider access. Tag evaluations also require fresh approval of the exact release PR head.
  • Read product and measurement baselines from one pinned main commit. Never rerun baseline commits.
  • Report correctness, tokens, tool calls, accounting status, and cost availability. Flag incompatible comparisons.
  • Keep approved records in Git with immutable content identities. Keep transient reports and traces as artifacts for 90 days.
  • Prepare promotion proposals through a separate approved workflow on main.
  • Notify Zoomote through the existing release webhook. The consumer verifies the successful run, artifact digest, source identity, and current baseline pointers.
  • Let Zoomote open the data-only baseline PR. A normal protected-main merge activates the baseline.

Actions keeps read-only GitHub permissions. Actions does not create or approve PRs.

Promotion records its dispatch SHA. Unrelated main updates do not invalidate a proposal. Changed baseline pointers require a new proposal.

The proposal writer uses safeWriteJson. A small typing fix preserves existing backup recovery behavior under strict indexed-access checks.

This supports Reliability First through repeatable release evidence and explicit approval.

Test Procedure

Local offline validation passed:

  • 553 evaluation tests.
  • 58 workflow tests.
  • 15 JSON recovery tests.
  • Evaluation and extension type checks.
  • Applicable ESLint and Prettier checks.
  • Both Knip checks. ESLint suppression counts did not increase.
pnpm test:agent-evals:unit
node --test scripts/agent-evals-workflow.test.mjs
pnpm --dir src exec vitest run utils/__tests__/jsonFileRecovery.test.ts
pnpm agent-evals:check-types
pnpm --dir src run check-types
pnpm knip
pnpm knip:production

The SDD models cover credential access, report integrity, baseline promotion, bot handoff, and publication independence.

TLA_JAR=/path/to/tla2tools.jar docs/architecture/tla/check.sh EvalWorkflow EvalBaselineReport EvalBaselines EvalReleaseOrder

All base configurations passed. Guard-removal variants failed as expected. Code tests detected the corresponding removed guards.

Reporting and promotion use separate models. They check 1,364 states combined, compared with 6,400 before separation. The release model checks 10 states.

The models check their stated abstractions. They do not prove the implementation or hosted settings correct.

Pre-Submission Checklist

  • Issue Linked: [ENHANCEMENT] Run the agent evaluation advisory report during release preparation #2085.
  • Scope: Advisory release evaluations and approved baseline promotion.
  • Self-Review: Reviewed the implementation and validation boundaries.
  • Writing Style: Short sentences and plain words.
  • Testing: Added focused unit and workflow tests.
  • Test Helpers: Shared mechanical fixture setup; scenario-specific assertions remain visible.
  • Documentation Impact: Updated setup, release instructions, and the Zoomote command.
  • Contribution Guidelines: Followed repository guidance.
  • Live Validation: Validate the protected-tag run and Zoomote handoff after merge.

Provider listing, recorded streams, and visual snapshots do not apply.

Documentation Updates

Updated the evaluation README, release command, kickoff instructions, and baseline promotion command.

The README documents tag rules, environment approvals, webhook setup, and model checks. Keep Actions PR creation disabled.

Additional Notes

Repository settings remain unchanged. Maintainers must configure the protected tag and environment rules before live use.

No live provider evaluation or Discord notification ran during this work. The first live evaluation and Zoomote PR handoff remain unverified.

Cost estimates stay unavailable until maintainers configure real rates.

AI assistance was used for implementation, models, tests, and PR preparation.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore (reviewers only)

Failed Failed checks: 1 error · 1 warning

Check name Status Explanation Resolution
Security Boundaries Error The tag lane of the evaluation gate does not enforce the approval it claims to enforce. Changed path: scripts/agent-evals/authorize-evaluation.mts (lines 26-49) and scripts/agent-evals/evaluation-auth… Bind the tag-lane approval to the exact head SHA in code. Do not rely only on repository settings. Options: - Query the latest APPROVED review for the release PR and require its commit_id to equal the tagged SHA (for example, through the …
Regression Evidence Warning Summary: The PR adds release baseline logic with a broad test set. Two changed behaviors have concrete negative-case gaps at the unit-test layer. Gap 1 (main gap): product and measurement promotion gu… 1. In scripts/agent-evals/baseline-proposal.test.ts, add applyBaselineProposal cases for kind "product" and kind "measurement": - kind "product" with an index that has no measurement pointer must reject with "Establish a measurement baselin…
Passed Passed checks: 2 passed

Check name Status Explanation
Persistence Integrity Passed The check fails only when a changed persistence path can lose or corrupt state. I reviewed the changed persistence paths in commit 89acdbd (PR #2809, head issue/2085, author edelauna). - `scripts/agen…
Lifecycle Resource Cleanup Passed Reviewed the changed lifecycle paths in PR #2809 (head 89acdbd, merge-base 6df2566). I found no path that leaks a listener, watcher, provider, timer, task, or other resource, and no duplicate work aft…
Full details: Persistence Integrity

Explanation

The check fails only when a changed persistence path can lose or corrupt state. I reviewed the changed persistence paths in commit 89acdbd (PR #2809, head issue/2085, author edelauna). - scripts/agent-evals/release-baselines.ts:329-343 (writeBaselineProposal): it writes the baseline record with flag: "wx", then writes index.json with a plain fs.writeFile. The index write is not atomic. The repo has fs-atomic.ts (writeFileAtomic), which sibling code uses (coding-compare.ts, host-build.ts). A crash or ENOSPC during the index write could leave a truncated index.json. A crash between the two writes could leave an orphan record that makes a retry fail with EEXIST. The existing test at release-baselines.test.ts:206-209 covers only the EEXIST-before-index case. - scripts/agent-evals/baseline-proposal.ts:79-98 (applyBaselineProposal): it checks the index digest before writing. Its tests cover rejection of a changed index. - scripts/agent-evals/fs-atomic.ts and src/utils/safeWriteJson.ts: these are reused by new code, and the calls are awaited. - scripts/agent-evals/promote-baseline.mts:110: safeWriteJson is awaited. The proposal is digest-checked before use. - scripts/agent-evals/release-baselines.ts:401-404 (fetchBaselineSnapshot): it writes with wx into a snapshot directory from authorize-evaluation.mts. This is a fresh download, not a durable store. - src/utils/jsonFileRecovery.ts:212-228: the backupStats[0]! change keeps the same guard and behavior. The non-atomic index write is a real hardening gap. Its impact is limited, though. The durable baseline state is the Git main tree, and the PR states that a reviewed PR publishes the pointer change. Writes happen in an apply workspace before review and commit, and index and record loads validate digests and JSON. A crash there leaves a damaged working-tree file, not lost or corrupt durable state. Loss would need a corrupted file to be committed without review. Note: the PR description says the proposal writer uses safeWriteJson. writeBaselineProposal does not. Only promote-baseline.mts uses safeWriteJson. No changed path meets the stated failure condition, so the check passes. Residual risk: use writeFileAtomic for index.json and the record write to remove the partial-write window.

Full details: Lifecycle Resource Cleanup

Explanation

Reviewed the changed lifecycle paths in PR #2809 (head 89acdbd, merge-base 6df2566). I found no path that leaks a listener, watcher, provider, timer, task, or other resource, and no duplicate work after cancellation, disposal, or restart. Paths checked: - scripts/agent-evals/coding-side.mts and coding-compare.ts. The install and build steps now run in a loop through runBoundedPreparation. Each call checks isInterrupted() before it spawns, so an interrupt during install stops the build from starting. The timer is cleared on both error and exit. The process group is killed on exit. The preparation home is removed in finally. The worktree and scratch cleanup runs in the outer try/finally. - scripts/agent-evals/host-build.ts (new). verifyHostBuildOutputs only calls lstat, mkdir, and an atomic write. It opens no handles and starts no timers. - scripts/agent-evals/promote-baseline.mts and apply-baseline-proposal.mts. The scratch directory is created before its try, and fs.rm runs in finally. - scripts/agent-evals/baseline-handoff.ts. It uses AbortSignal.timeout(15_000) for the webhook request. No listener or timer is left behind. - packages/telemetry/src/TelemetryService.ts. The new recentExceptionFingerprints map is capped at EXCEPTION_DEDUPE_CACHE_LIMIT (100) and evicts its oldest entry, so it cannot grow without bound. The dedupe logic adds no timers or listeners. - src/api/providers/openrouter.ts and src/utils/jsonFileRecovery.ts. The changes are error-shaping and an index-access typing fix. They touch no resource lifecycle. - scripts/test-local.mjs. It uses synchronous spawnSync, so no child process outlives the call. A broad grep of added non-test lines for listeners, timers, watchers, spawns, and aborts matched only the paths above. The process.on("SIGINT"/"SIGTERM") handlers in the driver scripts are pre-existing or belong to short-lived CLI drivers that exit after cleanup. Their registration does not create a leak in a changed path. Limits: the diff is large, and I did not read every test file or workflow YAML. I did not run the code.

Full details: Security Boundaries

Explanation

The tag lane of the evaluation gate does not enforce the approval it claims to enforce. Changed path: scripts/agent-evals/authorize-evaluation.mts (lines 26-49) and scripts/agent-evals/evaluation-authorization.ts (lines 36-38, releaseReviewApproved). The PR description says tag evaluations "require fresh approval of the exact release PR head". The TLA note in docs/architecture/tla/EvalWorkflow.tla (line 36) says the properties "reject ... stale approvals". The code checks only three values: headRefOid === sha, reviewDecision === "APPROVED", and isDraft === false. It does not check that the approving review was submitted on that commit. GitHub keeps reviewDecision as APPROVED after new commits are pushed, unless the branch protection setting that dismisses stale approvals is enabled. The repository does not contain that setting, and the code does not verify it. This is the same kind of check that label-pr-review-state.yml already performs (review.commit_id === pr.head.sha, around lines 1107-1143), so the repository has the pattern but this change does not use it. Triggering sequence: 1. A release PR release/vX is approved at head H1. 2. A contributor with branch write access pushes an unreviewed commit H2 to the release branch. 3. A person with protected-tag rights pushes tag vX at H2. 4. headRefOid equals H2 and reviewDecision remains APPROVED, so the gate passes. 5. After environment approval, the job runs H2 with SOLHEIM_API_KEY (.github/workflows/agent-evals.yml, "Evaluate candidate" step). The gate can pass without approval of H2. The protected-tag rule and environment approval reduce the risk, but they do not replace the missing head-specific review check. The unit tests (evaluation-authorization.test.ts, lines 52-60) and workflow tests (agent-evals-workflow.test.mjs, lines 546 and 585) cover only mocked REVIEW_REQUIRED responses, so they do not detect this gap. Other notes, not counted as separate failures: - The authorization step runs from the candidate checkout (ref: github.sha). Candidate code therefore controls the gate that checks it. - The trust policy written by the "Prepare trust policy" step lists only the candidate SHA. The side's trust gate therefore checks the candidate against itself. - The webhook, artifact-provenance, and promotion checks reviewed in notify-baseline.mts, baseline-handoff.ts, promote-baseline.mts, release-baselines.ts, and baseline-proposal.ts fail closed and do not log secrets. I found no defect in those paths.

Resolution

Bind the tag-lane approval to the exact head SHA in code. Do not rely only on repository settings. Options: - Query the latest APPROVED review for the release PR and require its commit_id to equal the tagged SHA (for example, through the REST reviews endpoint or GraphQL latestReviews { commit { oid } }). - Or require that the repository enable stale-approval dismissal, and verify that setting in the workflow. Add tests that fail when an approval exists only on an earlier head, and when reviewDecision is APPROVED but the latest approval has a different commit_id. Then rerun the agent-evals unit and workflow tests.

Full details: Regression Evidence

Explanation

Summary: The PR adds release baseline logic with a broad test set. Two changed behaviors have concrete negative-case gaps at the unit-test layer. Gap 1 (main gap): product and measurement promotion guards. - scripts/agent-evals/baseline-proposal.ts applyBaselineProposal (lines 83-91) has a product branch. It throws "Establish a measurement baseline first" when no measurement pointer exists. It throws "A new measurement baseline needs explicit approval" when the measurement pins are incompatible with the proposal. - scripts/agent-evals/promote-baseline.mts (lines 79-84) repeats the same two guards for BASELINE_KIND=product. - scripts/agent-evals/baseline-proposal.test.ts imports applyBaselineProposal, but its only apply cases use proposal(), which has kind: "both" and beforeIndex: { version: 1 }. The stale and fresh cases never reach the product or measurement branches. - scripts/agent-evals-workflow.test.mjs promotion scenarios run only with BASELINE_KIND: "both". No test sets product or measurement. A grep for "Establish a measurement", "needs explicit approval", and BASELINE_KIND finds no test that exercises these guards. - A plausible regression exists. Removing either guard would let a product pointer be written with no measurement baseline, or with a measurement baseline that is incompatible. The spec (#2085) says incompatible measurement inputs must not produce a normal comparison, and only an explicit maintainer action may set a new measurement baseline. Gap 2: repetition mismatch in renderReleaseComparison. - scripts/agent-evals/release-baselines.ts lines 249-252 set compatibility.compatible = false when baseline.record.evidence.repetitions !== candidate.repetitions. - scripts/agent-evals/release-baselines.test.ts tests changed pins fields and runner fields, but never a changed repetition count. This negative case has no test. Checked and adequately covered: the baseline digest and provenance checks, source and release validation, fetchBaselineSnapshot pinning, the Discord handoff payload and webhook rejection cases, the OpenRouter handleStreamingError change (including the code undefined case), the telemetry single-capture change, the jsonFileRecovery type-only change, and the coding-summary failure paths (covered by scenario tests in agent-evals-workflow.test.mjs). Status: FAIL on the changed-behavior negative-case gaps above. Each gap has a lowest-layer test target in an existing test file.

Resolution

  1. In scripts/agent-evals/baseline-proposal.test.ts, add applyBaselineProposal cases for kind "product" and kind "measurement": - kind "product" with an index that has no measurement pointer must reject with "Establish a measurement baseline first". The directory must stay unchanged. - kind "product" with a measurement pointer whose pins differ from the proposal must reject with "needs explicit approval". - kind "product" with a compatible measurement pointer must write the new record and update only the product pointer. - kind "measurement" must update only the measurement pointer. 2. In scripts/agent-evals/release-baselines.test.ts, add a case where candidate.repetitions differs from baseline.record.evidence.repetitions. Assert that renderReleaseComparison returns "Incompatible comparison" and lists "repetitions". 3. Optionally, add one BASELINE_KIND=product scenario to scripts/agent-evals-workflow.test.mjs for the same guard in promote-baseline.mts.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Fix the failing required CI checks; awaiting-maintainer requires CI and automated review completion.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@edelauna edelauna changed the title feat(evals): add advisory release reports and baseline promotion Add advisory release evaluations and baseline promotion Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Changed-code mutation testing

Report for PR head 89acdbdf6784.

Surviving / uncovered mutants Advisories
0 1
Details: mutants, guidance, and reproduction

Changed-code mutation testing

PackageChanged executable linesValidKilledTimeoutSurvivedNo coverageResult
extension700000Advisory incomplete

Focused tests

  • extension (cwd src): The mutation run was incomplete; selected test file names were not recorded. See Advisory findings for the failure.

Reproduce locally

From a full checkout containing both commits:

pnpm install --frozen-lockfile
node scripts/stryker-diff.mjs ci --base 5c360695c200b5f5faf1914d1e3e7a3b7b2f7fee --head 637ec4151d4dedb3d80c493b763047f8fe7fe692

Mutation reports

  • extension: reports/mutation/extension/mutation.html

The workflow uploads generated reports in the changed-code-mutation-report artifact. A direct artifact link appears below after upload.

Advisory findings

  • extension Stryker preflight failed: 00:49:21 (2844) INFO ProjectReader Found 1 of 1454 file(s) to be mutated. 00:49:21 (2844) INFO Instrumenter Instrumented 1 source file(s) with 5 mutant(s) 00:49:22 (2844) INFO ConcurrencyTokenProvider Creating 2 test runner process(es). 00:49:22 (2844) INFO DryRunExecutor Note: running the dry-run only. No mutations will be tested. 00:49:22 (2844) INFO DryRunExecutor Starting initial test run (vitest test runner with "perTest" coverage analysis). This may take a while. 00:52:30 (2844) ERROR DryRunExecutor One or more tests failed in the initial test run: coding eval host command boundary rejects an outside-workspace git diff in clamp-range before command execution Cannot find module '../../../../scripts/agent-evals/coding-fixtures' imported from /home/runner/work/Zoo-Code/Zoo-Code/.stryker-tmp/sandbox-n8P3xM/core/tools/__tests__/coding-eval-boundary.spec.ts 00:52:30 (2844) ERROR Stryker There were failed tests in the initial test run. file:///home/runner/work/Zoo-Code/Zoo-Code/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@stryker-mutator/core/dist/src/process/3-dry-run-executor.js:65 throw new ConfigError('There were failed tests in the initial test run.'); ^ ConfigError: There were failed tests in the initial test run. at DryRunExecutor.validateResultCompleted (file:///home/runner/work/Zoo-Code/Zoo-Code/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@stryker-mutator/core/dist/src/process/3-dry-run-executor.js:65:27) at DryRunExecutor.executeDryRun (file:///home/runner/work/Zoo-Code/Zoo-Code/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@stryker-mutator/core/dist/src/process/3-dry-run-executor.js:100:14) at process.processTicksAndRejections (node:internal/process/task_queues:103:5) at async WorkItem.execute (file:///home/runner/work/Zoo-Code/Zoo-Code/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@stryker-mutator/core/dist/src/concurrent/pool.js:32:28) at async file:///home/runner/work/Zoo-Code/Zoo-Code/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@stryker-mutator/core/dist/src/concurrent/pool.js:69:13 { innerError: undefined } Node.js v22.23.4

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Run the agent evaluation advisory report during release preparation

1 participant